home *** CD-ROM | disk | FTP | other *** search
- How to use search and replace
-
- The IDE provides three basic kinds of search and replace functions. The first kind
- provides native search and replace within a file or document. The second kind provides a
- native search of a directory. The third kind provides access to search and replace from
- a script.
-
- The first and second capabilities use a common set of parameters which are exposed to
- scripts in the FindParameters object. Search and replace scripts distributed with the
- IDE also use the FindParameter object. For example, this means that if you change
- the case sensitive parameter in the Find In Files dialog, then that same value of case
- sensitive will be used for all other searches until you change it.
-
- The IDE also includes a Finder toolbar to make it easy to make changes. This tool bar
- incldues find next, find previous, find in open windows, find in files, replace next and
- replace in open windows commands. It also includes a combo box that displays the current
- search parameter and the current replace value. The search and replace histories are
- updated after each search or replace operation. The search value is updated each time a
- new selection is made in a line.
-
- Using search and replace in a script can be a powerful tool. For example the following
- script converts all HTML tags in a document to lower case.
-
- function DoCommand()
- {
- var editor = getActiveEditor();
- if (editor)
- {
- var findData = editor.findFirst("<[^>]*>", 0, 0, true, true, true);
- while(findData && findData.found)
- {
- var range = findData.range;
- var text = editor.copy(range);
- var lower = text.toLowerCase();
- editor.replace(lower, range);
- editor.findNext(findData);
- }
- editor.setActive();
- }
- }
-
-
- Copyright ⌐ 1997-1998 - Modelworks Software
-
-
-
-
-
-